package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderController {
    private static final String PAYMENT_URL = "cloud-payment-service";
    @Resource
    private RestTemplate restTemplate;

    @GetMapping
    @RequestMapping(value = "/order")
    public String getPayment() {
        return restTemplate.getForObject("http://"+PAYMENT_URL + "/payment/consul", String.class);
    }
}
